package kpi.javatraining6.gnatiuk.src.tester.readers;

import kpi.javatraining6.gnatiuk.src.tester.question.MultipleAnswerQuestion;
import kpi.javatraining6.gnatiuk.src.tester.question.OwnAnswerQuestion;
import kpi.javatraining6.gnatiuk.src.tester.question.Question;
import kpi.javatraining6.gnatiuk.src.tester.question.SingleAnswerQuestion;

public class QuestionFactory {
    public static Question getQuestion(String needType, QuestionValues questionValues) throws ClassNotFoundException {
         if (needType == null || questionValues == null) {
             throw new ClassNotFoundException();
         }
         switch (needType) {
             case "MultipleAnswerQuestion":
                 return new MultipleAnswerQuestion(questionValues);
             case "OwnAnswerQuestion":
                 return new OwnAnswerQuestion(questionValues);
             case "SingleAnswerQuestion":
                 return new SingleAnswerQuestion(questionValues);
             default:
                 throw new ClassNotFoundException();
         }
    }
}
